package com.firexxx;

import com.sun.tools.javac.code.Type;

import java.io.Serializable;
import java.lang.System;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.AbstractQueue;
import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;

public class OverrideMain {

    //重载：类函数间同名不同参，父子类间同名不同参
    static class OverrideBase {
        //都为非静态
        public void fun1(String a, String b) {

        }

        public void fun1(String a, Object b) {

        }

        //有一个是静态
        public static void fun2(String a, String b) {

        }

        public void fun2(String a, Object b) {

        }

        //都是静态
        public static void fun3(String a, String b) {

        }

        public static void fun3(String a, Object b) {

        }
    }

    static class OverrideDerived extends OverrideBase {
        public void fun1(String a, String b) {

        }
    }

    public static void main(String[] args) {
        OverrideBase overrideBase1 = new OverrideBase();
        //emitInvokevirtual
        overrideBase1.fun1("1", "1");
        //emitInvokevirtual
        overrideBase1.fun1("1", 1);
        //emitInvokestatic
        overrideBase1.fun2("2", "2");
        //emitInvokevirtual
        overrideBase1.fun2("2", 2);
        //emitInvokestatic
        overrideBase1.fun3("3", "3");
        //emitInvokestatic
        overrideBase1.fun3("3", 3);

        OverrideBase overrideBase2 = new OverrideDerived();
        overrideBase2.fun1("1", "1");
        overrideBase2.fun2("2", "2");

        OverrideDerived overrideDerived = new OverrideDerived();
        overrideDerived.fun1("1", "1");
        overrideDerived.fun2("2", "2");
    }
}
